<template>
  <div>
    <div class="item-info">
      <div
        :class="['single-item', item.flag ? 'active-item' : '']"
        v-for="(item, index) in singleItemList"
        :key="index"
      >
        <div>{{ item.name }}</div>
        <div class="item-logo">
          <img :src="item.logo" alt="" />
        </div>
      </div>
      <div class="single-item-info">
        <div class="info-line1">
          <div>{{ gameTitle }}</div>
          <div class="venue">{{ venueName }}</div>
        </div>
        <div class="info-line2">
          <div class="report-name">成绩公告</div>
          <div>{{ gameTime }}</div>
        </div>
      </div>
    </div>
    <div class="score-table-data" style="width: 100%;">
      <el-table
        :data="reportData"
        style="width: 100%"
        :header-cell-style="{ 'text-align': 'center' }"
        :cell-style="{ 'text-align': 'center' }"
      >
        <template v-for="(item, index) in tableHeader">
          <el-table-column :label="item.label" :prop="item.prop"> </el-table-column>
        </template>
      </el-table>
    </div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  created() {
    this.venueName = this.$route.query.venueName
    this.gameTime = this.$route.query.gameTime
    this.gameTitle = this.$route.query.gameTitle
    this.filePath = this.$route.query.filePath
    this.getReportData()
  },
  props: {},
  data() {
    return {
      tableHeader: [
        { prop: 'F_MatchName', label: '台号' },
        { prop: 'F_NameA', label: 'A方姓名' },
        { prop: 'F_DelegationA', label: 'A方单位' },
        { prop: 'F_NameB', label: 'B方姓名' },
        { prop: 'F_DelegationB', label: 'B方单位' },
        // { prop: 'F_ResultA', label: '黑棋成绩' },
        // { prop: 'F_ResultB', label: '白棋成绩' },
        { prop: 'F_Result', label: '比赛结果' }
        // { prop: 'F_Winner', label: '胜方' },
        // { prop: 'F_Loser', label: '败方' },
      ],
      tableData: [
        {
          F_MatchName: '1 ',
          F_NameA: '杨一',
          F_DelegationA: '河北',
          F_NameB: '2',
          F_DelegationB: '0',
          F_ResultA: '0',
          F_ResultB: '22',
          F_Result: '',
          F_Winner: '2',
          F_Loser: '21',
          F_Round: '2',
          F_MatchOrder: '4'
        }
      ],
      filePath: '',
      venueName: '',
      gameTime: '',
      gameTitle: '',
      singleItemList: [
        {
          name: '围棋',
          logo: require('@/assets/img/daily/GO.png'),
          flag: true
        }
      ]
    }
  },
  watch: {},
  computed: {
    ...mapState({
      reportData: state => state.schedule.reportData
    })
  },
  filters: {},
  components: {},
  methods: {
    getReportData() {
      this.$store
        .dispatch('getReportData', this.filePath + '.txt')
        .then(_ => {})
        .catch(error => {
          console.log(error)
        })
    }
  }
}
</script>
<style scoped lang="scss">
@import '@/assets/scss/item.scss';
</style>
